#include "tcp_server.hpp"
#include <memory>

void Usage()
{
    std::cout << "Please enter the correct format: " << std::endl
              << "      ./server [port]" << std::endl;
}

struct ChatService
{
    std::string operator()(std::string msg)
    {
        return msg;
    }
};

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage();
        exit(USAGE_ERR);
    }

    uint16_t port = atoi(argv[1]);

    std::unique_ptr<TcpServer> tsvr(new TcpServer(ChatService(), port));
    tsvr->Initial();
    tsvr->Start();
    
    return 0;
}